package com.tencent.mm.opensdk.modelbiz;

import android.os.Bundle;
import android.util.Log;
import com.tencent.mm.opensdk.modelbase.BaseReq;

public class JumpToBizProfile {
    public class Req extends BaseReq {
        private static final int EXT_MSG_LENGTH = 1024;
        private static final String TAG = "MicroMsg.SDK.JumpToBizProfile.Req";
        public String extMsg;
        public int profileType;
        public String toUserName;

        public Req() {

            this.profileType = 0;
        }

        public boolean checkArgs() {
            boolean v0 = false;
            if(this.toUserName == null || this.toUserName.length() == 0) {
                Log.e("MicroMsg.SDK.JumpToBizProfile.Req", "checkArgs fail, toUserName is invalid");
            }
            else {
                if(this.extMsg != null && this.extMsg.length() > 1024) {
                    Log.e("MicroMsg.SDK.JumpToBizProfile.Req", "ext msg is not null, while the length exceed 1024 bytes");
                    return v0;
                }

                if(this.profileType == 1 && (this.extMsg == null || this.extMsg.length() == 0)) {
                    Log.e("MicroMsg.SDK.JumpToBizProfile.Req", "scene is jump to hardware profile, while extmsg is null");
                    return v0;
                }

                v0 = true;
            }

            return v0;
        }

        public void fromBundle(Bundle arg2) {
            super.fromBundle(arg2);
            this.toUserName = arg2.getString("_wxapi_jump_to_biz_profile_req_to_user_name");
            this.extMsg = arg2.getString("_wxapi_jump_to_biz_profile_req_ext_msg");
        }

        public int getType() {
            return 7;
        }

        public void toBundle(Bundle arg3) {
            super.toBundle(arg3);
            arg3.putString("_wxapi_jump_to_biz_profile_req_to_user_name", this.toUserName);
            arg3.putString("_wxapi_jump_to_biz_profile_req_ext_msg", this.extMsg);
            arg3.putInt("_wxapi_jump_to_biz_profile_req_scene", 0);
            arg3.putInt("_wxapi_jump_to_biz_profile_req_profile_type", this.profileType);
        }
    }

    public static final int JUMP_TO_HARD_WARE_BIZ_PROFILE = 1;
    public static final int JUMP_TO_NORMAL_BIZ_PROFILE = 0;

    public JumpToBizProfile() {

    }
}

